<script setup lang="ts">
// import KnowledgeList from '@/components/KnowledgeList.vue'
import { useConsultStore } from '@/stores';
const store = useConsultStore()
const active = ref(0)
import { ConsultType } from '@/types/enum';
import { ref } from 'vue';
</script>

<template>
  <div class="page-home">
    <!--头部-->
    <div class="home-header">
        <div class="search">
            <cp-icon href="home-search" />
            <span>搜一搜：疾病/症状/医生/健康知识</span>
        </div>
    </div>
    <!--导航-->
    <div class="nav">
        <van-row justify="center" >
            <van-col span="8" >
                <router-link to="/" class="nav">
                    <cp-icon href="home-doctor"></cp-icon>
                    <p class="title">问医生</p>
                    <p class="desc">按科室查问医生</p>
                </router-link>
            </van-col>
            <van-col span="8" >
                <router-link to="/consult/fast" class="nav" @click="store.setType(ConsultType.Fast)">
                    <cp-icon href="home-graphic" ></cp-icon>
                    <p class="title">极速问诊</p>
                    <p class="desc">20s医生急速回复</p>
                </router-link>
            </van-col>
            <van-col span="8" >
                <router-link to="/" class="nav">
                    <cp-icon href="home-prescribe"></cp-icon>
                    <p class="title">开药门诊</p>
                    <p class="desc">线上买药更方便</p>
                </router-link>
            </van-col>
        </van-row>
    </div>
    <div class="navs">
        <van-row justify="center">
            <van-col span="6">
              <router-link to="/" class="nav">
                <cp-icon href="home-order"></cp-icon>
                <p class="title">药品订单</p>
              </router-link>
            </van-col>
            <van-col span="6">
          <router-link to="/" class="nav">
            <cp-icon href="home-docs"></cp-icon>
            <p class="title">健康档案</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav">
            <cp-icon href="home-rp"></cp-icon>
            <p class="title">我的处方</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav">
            <cp-icon href="home-find"></cp-icon>
            <p class="title">疾病查询</p>
          </router-link>
        </van-col>
        </van-row>
    </div>
    <div class="home-banner">
        <van-swipe indicator-color="#fff">
        <van-swipe-item>
          <img src="@/assets/ad.png" alt="" />
        </van-swipe-item>
        <van-swipe-item>
          <img src="@/assets/ad.png" alt="" />
        </van-swipe-item>
      </van-swipe>
    </div>
    <van-tabs shrink v-model:active="active">
      <van-tab title="关注" name="like">
        <follow-doctor></follow-doctor>
        <KnowledgeList type="like"/>
      </van-tab>
      <van-tab title="推荐" >
        <p v-for="i in 100" :key="i">
            <KnowledgeList type="like" />
        </p>
      </van-tab>
      <van-tab title="减脂">
        <KnowledgeList type="like"/>
      </van-tab>
      <van-tab title="饮食">
        <KnowledgeList type="like"/>
      </van-tab>
    </van-tabs>

  </div>
</template>
<style lang="scss" scoped>
.page-home{
    position: relative;
    .home-header{
        // position: relative;
        // top:0px;
        width: 100%;
        height: 150px;
        // overflow: scroll;
        background-color: var(--cp-primary);
        .search{
            position: fixed;
            top: 15px;
            // left: 50%;
            // margin-top: 15px;
            transform: translateX(5%);
            z-index:10;
            width: 80%;
            height: 40px;
            background-color: var(--cp-bg);
            border-radius: 20px;
            padding: 0 20px;
            display: flex;
            align-items: center;
            color: var(--cp-text2);
            font-size: 14px;
            span{
                display: inline-block;
                margin-left: 30px;
            }
        }
    }
    .nav{
        position: relative;
        width: 100%;
        .van-row{
            background-color: aliceblue;
            position: relative;
            width: 80%;
            margin: 0 auto;
            transform: translateY(-50%);
            border-radius: 10px;
            padding: 10px;
            box-shadow: 0 5px 5px rgba(0,0,0,0.1);
            .van-col{
                .nav{
                    font-size: small;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    flex-direction: column;
                    .title{
                        font-size: 16px;
                        color: var(--cp-text1);
                    }
                    .desc{
                        font-size: 12px;
                        color: var(--cp-text2);
                    }
                    .cp-icon{
                        font-size: 2px;
                    
                    }
                }
            }
        }
    }
    .navs{
        position: relative;
        width: 80%;
        margin: 0 auto;
        .van-row{
            .van-col{
            .nav{
                display: flex;
                flex-direction: column;
                justify-content: center;
                .cp-icon {
                    font-size: 21px;
                }
                text-align: center;
            }
        }
        }
    }
    .home-banner {
        padding: 10px 15px;
        height: 100px;
        img {
         width: 100%;
         height: 100%;
        }
    }
}

</style>
